#include <iostream>
#include <pthread.h>
#include <unistd.h>
using namespace std;

void *threadRoutine(void *args)
{
    int i = 0;
    while (true)
    {
        cout << "新线程: " << (char *)args << " running" << endl;
        sleep(1);
        if (i++ == 10)
            break;
    }
}
int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, threadRoutine, (void *)"thread1");
    pthread_join(tid, nullptr);
    cout << "main thread wait done, main quit" << endl;
    return 0;
}